<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core'%>
<style>
<!--
.pageCurrent {
	color: red;
}
-->
</style>
<script type="text/javascript">
	function jumpPage(goPage) {
		var currentPageObj = document.getElementById("currentPage");
		var totalPage = document.getElementById("totalPage").value;
		if (goPage != null) {
			currentPageObj.value = goPage;
			document.forms[0].submit();
		} else {
			var num = document.getElementById('jumpNumber').value;
			var re = /^[+]?[0-9]*$/;
			if (!re.test(num)) {
				$("#jumpNumber").val("");
				$("#jumpNumber").focus();
				art.dialog.tips('请输入有效数字');
				return false;
			} else if ((parseInt(num) > parseInt(totalPage))
					|| (parseInt(num) < 1)) {
				$("#jumpNumber").val("");
				$("#jumpNumber").focus();
				art.dialog.tips('请输入有效数字');
				return false;
			} else if(num == ""){
				$("#jumpNumber").val("");
				$("#jumpNumber").focus();
				art.dialog.tips('请输入有效数字');
				return false;
			} {
				currentPageObj.value = document.getElementById("jumpNumber").value;
				document.forms[0].submit();
			}
		}
	}
	
	function pre() {
		var currentPage = parseInt(document.getElementById("currentPage").value);
		document.getElementById("currentPage").value = currentPage - 2;
		document.forms[0].submit();
	}

	function next() {
		var currentPage = parseInt(document.getElementById("currentPage").value);
		document.getElementById("currentPage").value = currentPage + 2;
		document.forms[0].submit();
	}
	/* jQuery.noConflict();
	jQuery(document)
			.ready(
					function() {
						var currentPage = parseInt(document
								.getElementById("currentPage").value);
						var totalPage = parseInt(document
								.getElementById("totalPage").value);
						if (currentPage < 6) {
							for ( var h = 0; h <= 5; h++) {
								j("#page" + h).css("display", "inline-block");
							}
						}
						if (currentPage > 4) {
							j("#pre").css("display", "inline-block");

							for ( var k = currentPage - 1; k >= 0; k--) {
								j("#page" + k).css("display", "none");
							}
							for ( var m = currentPage - 1; m < currentPage + 5; m++) {
								j("#page" + m).css("display", "inline-block");
							}
							for ( var i = currentPage + 5; i <= totalPage; i++) {
								j("#page" + i).css("display", "none");
							}
						}

						if (totalPage > 5) {
							j("#next").css("display", "inline-block");
						}
						if (currentPage == totalPage) {
							j("#next").css("display", "none");
						}
					}); */

</script>
<p class="pageBox">
	<button type="button" class="grayBtn1"
		onclick="JavaScript:jumpPage(1);"
		<c:if test="${paginationSupport.curPage==1}">disabled</c:if>>首页</button>

	<button type="button" class="grayBtn1"
		<c:if test="${paginationSupport.curPage==1}">disabled</c:if>
		<c:if test="${paginationSupport.curPage>1}">onclick="JavaScript:jumpPage(${paginationSupport.curPage - 1 });"</c:if>>上一页</button>
	<a href="javascript:pre();" style="color: #f48402; display: none;"
		id="pre"> <<...</a>
	<c:forEach var="i" begin="1" end="${paginationSupport.totalPage}">
		<a href="JavaScript:jumpPage(${i});" id="page${i}" style="display:none;"
			<c:if test="${paginationSupport.curPage==i}">class="pageCurrent"</c:if>>${i}</a>
	</c:forEach>
	<a href="javascript:next();" style="color: #f48402; display: none;"
		id="next">...>> </a>

	<button type="button" class="grayBtn1"
		<c:if test="${paginationSupport.curPage<paginationSupport.totalPage}"> onclick="JavaScript:jumpPage(${paginationSupport.curPage + 1 });" </c:if>
		<c:if test="${paginationSupport.curPage==paginationSupport.totalPage}">disabled</c:if>>下一页</button>

	<button type="button" class="grayBtn1" style="float:none;"
		<c:if test="${paginationSupport.curPage==paginationSupport.totalPage}">disabled</c:if>
		<c:if test="${paginationSupport.curPage<paginationSupport.totalPage}">  onclick="JavaScript:jumpPage(${paginationSupport.totalPage});"</c:if>>尾页</button>
	${paginationSupport.curPage} /${paginationSupport.totalPage}
	共${paginationSupport.totalCount}条 <input name="goPage"
		size="5" style="width:50px" class="pages" type="text" id="jumpNumber" /> 页 <input
		name="curPage" id="currentPage" type="hidden"
		value="${paginationSupport.curPage}" /> <input
		name="totalPage" id="totalPage" type="hidden"
		value="${paginationSupport.totalPage}" /> <input
		name="totalCount" id="totalCount" type="hidden"
		value="${paginationSupport.totalCount}" />
	<button type="button" class="grayBtn1" onclick="JavaScript:jumpPage();">GO</button>
</p>